<?php
// 设置页面title和菜单懒得选中样式
   $page_title="Blog";
   $menu_active="index.php";
// 导入头部文件
   require_once "header.php";
   require_once "models/funPackge.php";
    $sql="select * from `essay`";
    $result=sqlQuery($sql,0);
?>
    <main>
        <!--首页main-->
        <div id="indexMain">
            <!--图片置放区-->
            <div id="mainImg">
                <img src="public/img/indexMainImg.jpg" alt="放置图片">
            </div>
            <!--最新文章-->
            <div id="newEssay">
                <h3>
                    最新<span>文章</span>
                </h3>
                <div id="newEssayMain">
                    <ul>
                                <!--           最新文章循环打印             -->
                        <?php foreach ($result as $key=> $value){?>
                            <li>
                                <h3>
                                    <a href="">
                                        <?=$value['essayTitle']?>
                                    </a>
                                </h3>
                                <div class="img_Text">
                                    <div class="essayImg">
                                        <img src="upload/img/<?=$value['essayImg']?> " alt="文章相框">
                                    </div>
                                    <div class="essayText">
                                        <?=nl2p($value['essaySyn'])?>
                                        <a href="readEssay.php?essayId=<?=$value['eid']?>" class="readAll">
                                            阅读全文
                                        </a>
                                    </div>
                                </div>
                                <div class="essayBottom">
                                <span>
                                    <?=date("Y/m/d",$value['addTime'])?>
                                </span>
                                    <span>
                                    作者：<?=$value['author']?>
                                    </span>
                                    <span>
                                    个人博客：
                                    [
                                        <a href="#">
                                            <?=$value['essayType']?>
                                        </a>
                                    ]
                                </span>
                                </div>
                            </li>
                        <?php }?>
                    </ul>
                </div>
            </div>
             <!--文章推荐-->
            <div id="reEssay">
                <h3>
                    文章<span>推荐</span>
                </h3>
                <ul id="reEssayUl">
                                <!--         推荐文章循环打印           -->
                    <?php foreach ($result as $key=> $value){
                        ?>
                        <li>
                            <a href="readEssay.php?essayId=<?=$value['eid']?>">
                                <b>
                                [<?=($value['isOri']==0?"原创":"转载")?>]
                                </b>
                                <?=$value['essayTitle']?>
                                <span>
                                    <?=date("Y/m/d",$value['addTime'])?>
                                </span>
                            </a>
                        </li>
                   <?php }
                    ?>
                </ul>
        </div>
    </main>
<?php
//  导入底部文件
    include "footer.php";
?>